<template>
  <div class="container">
    <my-search-form v-bind="searchFormConfig" @search="search" />

    <my-table
      :tableConfig="tableConfig"
      :tableData="contentData"
      :totalCount="453"
    >
      <template #handle="scope">
        <div class="btnGroup" :key="scope.index">
          <el-button size="mini">停用</el-button>
          <el-button size="mini">操作</el-button>
          <el-button size="mini">详情</el-button>
        </div>
      </template>
    </my-table>
  </div>
</template>

<script>
import myTable from "@/components/myTable/myTable.vue";
import mySearchForm from "@/components/mySearchForm/mySearchForm";

import { searchFormConfig, tableConfig } from "./src/config";

export default {
  components: { myTable, mySearchForm },
  data() {
    return {
      contentData: [
        {
          value1: "暖通空调运维",
          value2: "教职工生活区",
          value3: "10",
          value4: "2021-07-11 11:09:22",
          value5: "每周周五",
          value6: "08:00:00 - 16:00:00",
          value7: "李工",
          value8: "-",
          value9: "2021-07-11 11:09:22",
          value10: "启用"
        }
      ],
      tableConfig,
      searchFormConfig
    };
  },
  methods: {
    // 假数据
    initDataTest() {
      for (let i = 0; i < 9; i++) {
        const data = JSON.parse(JSON.stringify(this.contentData[0]));
        data.value1 = "暖通空调运维" + (i + 1);
        this.contentData.push(data);
      }
    },
    search(data) {
      // 后期还需要考虑table的页数问题  拼接下参数即可
      console.log(data);
    }
  },
  mounted() {
    this.initDataTest();
  }
};
</script>

<style lang="scss" scoped></style>
